function validateForm(form)
{
	if (trim(form.loginId.value)!="") 
	{
			
		if (!/^([a-zA-z_]{1})([\w]*)$/g.test(form.loginId.value)){
				sl_alert("'用户名'只可包含字母、数字或下划线，且开头的只能是字母或下划线！");
				form.loginId.focus();
				form.loginId.select();
				return false;
		}	
		if (form.loginId.value.length < 2) {
			sl_alert("用户名应大于2个小于15个字符");
			form.loginId.focus();
			return false;
		}
		if (form.loginId.value.length > 30) {
			sl_alert("用户名应大于3个,小于15个字符");
			form.loginId.focus();
			return false;
		}
		if (form.loginId.value.indexOf(" ")!=-1){
			sl_alert("用户名中不能含有空格！！！");
			form.loginId.focus();
			return false;
		}
		if (form.password.value.length == 0) {
			sl_alert("请输入您的密码");
			form.password.focus();
			return false;
		}
			if (form.password.value.length < 6) {
			sl_alert("密码至少6位");
			form.password.focus();
			return false;
		}
	}
	if(!sl_check(form.title,"标题",100,1)) return false; 
	if(!sl_checkHTML(form.title,"标题")) return false;	
	if(!sl_checkNull(form.content,"正文")) return false; 	
	
	return true;
}


function topicIlike(topicId,userId)
{	
	if(userId==null||parseInt(userId)<=0)
	{
		sl_alert("您尚未登陆，请先登陆再执行本功能！");
		return false;
	}
	buffalo.remoteCall("topicIlikeServiceAjaxService.doBookTopic",[topicId,userId], function(reply) 
    {
        var ret = reply.getResult();
       	ajaxSubmit(ret,"订阅成功！");        
    }); 	
}

function topicBuy(topicId,userId,topicTypeNum)
{
	if(userId==null||parseInt(userId)<=0)
	{
		sl_alert("您尚未登陆，请先登陆再执行本功能！");
		return false;
	}
	var obj = {};   
    
	obj[Buffalo.BOCLASS] = "java.util.HashMap";
	
	obj.topicId = topicId;
	obj.userId = userId;
	obj.topicTypeNum = topicTypeNum;
	
	buffalo.remoteCall("topicBuyServiceAjaxService.doBuyTopic",[obj], function(reply) 
    {
        var ret = reply.getResult();
       	ajaxSubmit(ret,"购买成功！","reload");        
    });
}
